# 豆可のMi-宁:
# 新建一个项目，命名为：homeWorkPro
# 在该项目下新建一个py文件，命名为：homeWk
# 在该py文件下完成以下作业：
# 1. 编写程序，完成以下要求：
#     提示用户进行输入数据
import copy
import keyword
import random


#     获取用户输入的数值（需要获取2个）
#     对获取的两个数字进行求和运算，并输出相应的结果


# a=float(input("请输入第一个数字:"))
# b=float(input("请输入第二个数字:"))
# c=a+b
# d=a*b
# print(f"输入的俩个数之和为{c},之积为{d}")
#


# 3. 打印出以下内容（注意格式）:
#     ==================================
#     =        欢迎进入到身份认证系统V1.0
#     = 1. 登录
#     = 2. 退出
#     = 3. 认证
#     = 4. 修改密码
#     ==================================


# print('''
#      ==================================
#      =        欢迎进入到身份认证系统V1.0
#      = 1. 登录
#      = 2. 退出
#      = 3. 认证
#      = 4. 修改密码
#      ==================================
# ''')


# 4. 编写程序，从键盘获取一个人的信息，然后按照下面格式显示
#     ==================================
#     姓名: dongGe
#     QQ:xxxxxxx
#     手机号:131xxxxxx
#     公司地址:北京市xxxx
#     ==================================


# name=input("请输入你的姓名:")
# QQ=input("请输入你的QQ号:")
# tel=input("请输入你的手机号:")
# aress=input("请输入你的地址:")
# print(f'''
#      ==================================
#      姓名: {name}
#      QQ:{QQ}
#      手机号:{tel}
#      公司地址:{aress}
#      ==================================
# ''')


# 5. 编写程序，从键盘获取用户名和密码，
#     亲爱的xxx，欢迎登陆 爱学习管理系统


# cname=input("请输入你的用户名:")
# cpwd=input("请输入你的密码:")
# print(f"亲爱的{cname}，欢迎登陆 爱学习管理系统")


#
#
# 要求：每道题均有注释
#
# 6，list0=[1,34,"hello","abc","abc"]
# list1=[11，2，13，41，5，61，7，18，9，10]
#
# list0=[1,34,"hello","abc","abc"]
# list1=[11,2,13,41,5,61,7,18,9,10]
# 1.追加list0：元组：(1,2,3)

# a=(1,2,3)
# list0.append(a)
# print(list0)

# 2.在list1在第三个元素前插入，数字：11

# list1.insert(2,11)
# print(list1)


# 3.list0找到abc下标 ，并修改成80

# for index,lt in enumerate(list0):
#  print(f"{lt},{index}")
#  list0[3]=80
#  list0[4]=80
# print(list0)

# 4.list0在删除第4个元素

# list0.pop(3)
# print(list0)

# 5.打印出list1的类型、长度

# print(len(list1),type(list1))

# 7.每隔2个打印出list1中的元素

# print(list1[::3])

# 8.取出list1中最后一个元素，并打印

# print(list1[-1])

# 9.修改list1中第4个元素为：100

# list1[3]=100
# print(list1)

# 12.定义一个空list2
# list2=[]
# print(list2)
#
# 豆可のMi-宁:
# 元组
# tup1=(12,23,45)
# tup2=("ab",)
# tup1=(12,23,45)
# tup2=("ab",)
# 1.将元组tup1，与tup2组合在一起，并打印出来

# tup4=tup2+tup1
# print(tup4)

# 2.将元组tup2 复制3次并打印

# print(tup2*3)

# 3.求元组tup1的长度并打印

# print(len(tup1))

# 4.删除元组tup2，并打印

# tup2_list=list(tup2)
# tup2_list.remove("ab")
# tup2=tuple(tup2_list)
# print(tup2)

# 5.定义一个空元组，tup3

# tup3=()
#
# 豆可のMi-宁:
# 5、通过键盘获取姓名、QQ、手机号
# 并通过三种方式实现格式化输出。"我的姓名是：XXX，qq号是：XXX，手机号是：XXX"

# name1=input("请输入你的姓名:")
# QQ1=input("请输入你的QQ号:")
# tel1=input("请输入你的手机号:")
# print(f"我的姓名是：{name1}，qq号是：{QQ1}，手机号是：{tel1}")
# print("我的姓名是：{}，qq号是：{}，手机号是：{}".format(name1,QQ1,tel1))
# print("我的姓名是：%s，qq号是：%s，手机号是：%s" %(name1,QQ1,tel1))


#
# 豆可のMi-宁:
# 10.s="abcdefghigklmnopqrstuvwxyz"
# s="abcdefghigklmnopqrstuvwxyz"
# # 1.分别获取最后一个，第三个
# print(s[-1],s[2])
# # 2.每隔2个打印出s中的元素
# print(s[::3])
# # 3.获取第4个到第10个字符
# print(s[3:10])


# d={"name":"zhangsan","id":"5465131","age":18}
# print(d.get("name"))


# sss={"sdasd","dsa",1,2,3}
# sss.remove("dsa")
# sss.add("啊飒飒的")
#
# print(sss,type(sss))
# vss_s={"sdasd","dsa",1,2,3}


# a="10"
# b=int(a)
# c=float(a)
# d=tuple(a)
# f=list(a)
# g=set(a)
# h=bool(a)
# print(b,type(b))
# print(c,type(c))
# print(d,type(d))
# print(f,type(f))
# print(g,type(g))
# print(h,type(h))


# a=10
# b=str(a)
# c=float(a)
# #d=tuple(a)
# #f=list(a)
# #g=set(a)
# h=bool(a)
# print(b,type(b))
# print(c,type(c))
# #print(d,type(d))
# #print(f,type(f))
# #print(g,type(g))
# print(h,type(h))

# a=10.0
# b=int(a)
# c=str(a)
# #d=tuple(a)
# #f=list(a)
# #g=set(a)
# h=bool(a)
# print(b,type(b))
# print(c,type(c))
# #print(d,type(d))
# #print(f,type(f))
# #print(g,type(g))
# print(h,type(h))


# a=("10","10")
# print(a)
# # b=int(a)
# # c=float(a)
# #d=str(a)
# # f=list(a)
# g=set(a)
# h=bool(a)
# l=dict(a)
# # print(b,type(b))
# # print(c,type(c))
# #print(d,type(d))
# # print(f,type(f))
# print(g,type(g))
# print(h,type(h))
# print(l,type(l))

# a=[10]
# #b=int(a)
# #c=float(a)
# d=tuple(a)
# f=str(a)
# g=set(a)
# h=bool(a)
# #print(b,type(b))
# #print(c,type(c))
# print(d,type(d))
# print(f,type(f))
# print(g,type(g))
# print(h,type(h))

# a={"name":"zhangsan"}
# #b=int(a)
# #c=float(a)
# d=tuple(a)
# f=list(a)
# g=set(a)
# h=bool(a)
# #print(b,type(b))
# #print(c,type(c))
# print(d,type(d))
# print(f,type(f))
# print(g,type(g))
# print(h,type(h))

# a=True
# b=int(a)
# c=float(a)
# d=str(a)
# #d=tuple(a)
# #f=list(a)
# #g=set(a)
# #h=bool(a)
# print(b,type(b))
# # print(c,type(c))
# print(d,type(d))
# # print(f,type(f))
# # print(g,type(g))
# # print(h,type(h))


# if age >= 40:
#     print("卡")
#     if age <= 50:
#         print("领一盒")
#     elif age <= 70:
#         print("领俩盒")
#
#
# elif age >= 20:
#     print("鲜花")
# elif age >= 10:
#     print("10元")
# elif age >= 0:
#     print("铅笔")
# else:
#     print("on")
# print("领取结束")

# a=["yangyang",1,5,"dasdas","dsad555"]
# b={"name":"zhangsan","id":1,"age":45}
# c=("dsasd",1,8,7,"dsadasd",5.55)


# for i in range(1,5):
#     print(a[i])
#     print(c[i])
#
#
# for key,value in b.items():
#     print(f"我的键是：{key},我的值是：{value}")


# l=[90,80,95,70,85]
# for i in range(0,len(l)-1):
#     for j in range(0,len(l)-1):
#         if l[j]>l[j+1]:
#             l[j],l[j+1]=l[j+1],l[j]
# print(l)
#
#
# a=3
# b=4
# c=a if a>b else b
# print(c)

# 豆可のMi-宁:
# 7、
# 字典
# dict1={"name":"zhangsan"}
# # 1.增加元素：key=address，value="河南郑州"
# dict3={"address":"河南郑州"}
# dict1.update(dict3)
# print(dict1)
# # 2.获取所有的item并打印
# for i,j in dict1.items():
#     print(i,j)
# # 3.获取所有的key并打印
# for i,j in dict1.items():
#     print(i,j)
# # 4.获取address的值并打印（分别用两种形式完成：若键不存在时不能报错，键不存在时报错）
# print(dict1.get("address"))
# print(dict1["address"])
# # 6.修改键“name”的值为：“lisi”
# dict1["name"]="lisi"
# print(dict1)
# # 7.分别查看字典dict1的长度及类型，并打印
# print(len(dict1),type(dict1))
# # 8.清空字典dict1，并打印
# dict1.clear()
# print(dict1)
# # 9.定义一个空字典，dict2
# dict2={}
# print(dict2)
# # 8、将元组（90,30,99,89,50,70,60,60,40,50,60）去重并从小到大排序。
# yuanzu=(90,30,99,89,50,70,60,60,40,50,60)
# dicyuanzu=set(yuanzu)
# yuanzu=tuple(dicyuanzu)
# yuanzulist=list(yuanzu)
# for i in range(0,len(yuanzulist)-1):
#     for j in range(0,len(yuanzulist)-1):
#         if yuanzulist[j]>yuanzulist[j+1]:
#             yuanzulist[j],yuanzulist[j+1]=yuanzulist[j+1],yuanzulist[j]
# yuanzu=tuple(yuanzulist)
# print(yuanzu)
#
# 豆可のMi-宁:
#
# 11、
# 猜拳游戏，用户输入剪刀(0)  石头(1)  布(2)，与电脑程序随机生成一个数字范围在(0,2),来判断是获胜、平局，还是输了。
# 注：随机数使用代码：rm=random.randint(0,2)
# a=int(input("请输入剪刀(0)  石头(1)  布(2):"))
# rm=random.randint(0,2)
# print(rm)
# if a==0:
#     if rm==0:
#         print("平局")
#     elif rm==1:
#         print("输了")
#     elif rm==2:
#         print("赢了")
# elif a==1:
#     if rm==0:
#         print("赢了")
#     elif rm==1:
#         print("平局")
#     elif rm==2:
#         print("输了")
# elif a==2:
#     if rm==0:
#         print("输了")
#     elif rm==1:
#         print("赢了")
#     elif rm==2:
#         print("赢了")
# else:
#     print("请输入正确格式")
# print("游戏结束")
# 豆可のMi-宁:
# 13.打印九九乘法口诀

# for i in range(1,10):
#     for j in range(1,10):
#         print(f"{i}*{j}={i*j}",end=",")
#     print(end="\n")
# 14.
# 1.打印出1~100之间的偶数
# for i in range(1,100):
#     if i%2==0:
#         print(i,end=",")
# 2.计算1~100之间共多少个偶数
# num=0
# for i in range(1,100):
#     if i % 2 == 0:
#         num+=1
# print(num)
# 3.计算1~100之间偶数的累积和

# sum=0
# for i in range(1,100):
#     if i % 2 == 0:
#         sum=sum+i
# print(sum)
#
# for循环遍历列表，不为空则输出列表中内容，为空则输出为空的提示信息。
# t=["dasda","","sdasd",5,"",7]
# for i in range(0,len(t)):
#     if t[i]=="":
#         print(f"第{i+1}个元素为空")
#     else:
#         print(t[i])
# while循环，满足条件时输出内容，不满足时输出跳出循环的提示。
# i=0
# while len(t)>i:
#     if t[i]!="":
#         print(t[i])
#     else:
#         break
#     i+=1

#
#
# 13、
# score=[90,30,99,89,50,70,60,60,40,50,60]
# 1.给成绩排序，从高到低，并打印出新成绩列表，同时打印出总的循环次数（for循环）
# count=0
# for i in range(0,len(score)-1):
#     for j in range(0,len(score)-1):
#         if score[j]<score[j+1]:
#             score[j],score[j+1]=score[j+1],score[j]
#     count+=1
# print(score)
# print(count)

# 2.统计成绩中60的个数（for循环)
# c=0
# for i in range(0,len(score)):
#     if score[i]==60:
#         c+=1
# print(c)
# 3.查找成绩中是否有某个分数，若有打印出来并说明存在，
# 若不存在，打印出：未找到（使用while循环））
# a=int(input("请输入一个数："))
# i=0
#
# while(len(score)>i):
#     if score[i]==a:
#         print(f"存在分数：{score[i]}")
#
#     print("未找到")
#     i += 1


#
# 豆可のMi-宁:
#
# 15、
# score=[90,30,99,89,50,70,60,60,40,50,60]，按照从大到小进行排列
# score=[90,30,99,89,50,70,60,60,40,50,60]
# count=0
# for i in range(0,len(score)-1):
#     for j in range(0,len(score)-1):
#         if score[j]<score[j+1]:
#             score[j],score[j+1]=score[j+1],score[j]
#     count+=1
# print(score)
# print(count)
#
#
# 16、通过键盘获取两个数，用三元表达式赋值法将最小值赋给变量：iMin
# a=int(input("请输入第一个数"))
# b=int(input("请输入第二个数"))
# imin=a if a<b else b
# print(imin)
# a=[i for i in range(2,101,2)]
# b=[i/2 for i in range(2,101,2) if i%4==0]
# l=[i+1 if i%2==0 else i+3 for i in range(2,101,1)]
# print(a)
# print(b)
# print(l)

# p=[]
# m=[10,20,'a','b']
# for i in m:
#     if  isinstance(i,int):
#         p.append(i)
# print(p)
#
#
# c=[i for i in m if isinstance(i,int)]
# print(c)
#
# t=(1,2,(3,4))
# l=(1,2,[3,4])
# t1=copy.copy(t)
# #l1=copy.copy(l)
# t2=copy.deepcopy(t)
# #l2=copy.deepcopy(l)
# # print(t,id(t))
# print(l,id(l))
# # print(t1,id(t1))
# # print(l1,id(l1))
# # print(t2,id(t2))
# # print(l2,id(l2))
#
#
# l[2].append(5)
# l1=copy.copy(l)
# l2=copy.deepcopy(l)
# print(l,id(l))
# print(l1,id(l1))
# print(l2,id(l2))

# 8、将元组（90,30,99,89,50,70,60,60,40,50,60）去重并从小到大排序（使用冒泡排序）。
# from copy import t
# from typing import List


# t = (90, 30, 99, 89, 50, 70, 60, 60, 40, 50, 60)
# # s = set(t)
# l = list(set(t))
# for i in range(1, len(l)):
#     for j in range(1, len(l) - 1):
#         if l[j] > l[j + 1]:
#             l[i], l[j] = l[j], l[i]
# t = tuple(l)
# print(t)

# 9、使用列表推导式分别生成，1~500的5的倍数，1-500的偶数自加5，1到100之间偶数*2，奇数*3
# l=[i for i in range(5,501,5)]
# print(l)
# l=[i+5 for i in range(1,501,1) if i%2==0]
# print(l)
# l=[i*3 if i%2==1 else i*2 for i in range(1,101)]
# print(l)
# 16、通过键盘获取两个数，用三元表达式赋值法将最小值赋给变量：iMin
# a=20
# b=10
# iMin=a if a<b else b
# print(iMin)
# 13、定义一个形参类型分别是必填项字符串1、，选填字符串2，不定长元组、不定长字典的函数，分别打印出该字符串、元组内容，字典的值
# 分别调用该函数：参数是仅必填项、  必填+选填、不定长元组、不定长字典
# def useR(a1):
#     return a1
# def useR2(a1, a2):
#     return a2
# def useR3(*t):
#     return t
# def useR4(**d):
#     return d
# 15：题目10中的加、减、乘、除 分别定义成匿名函数，去调用
# jia=lambda a,b:a+b
# print(jia(1,2))
# jian=lambda a,b:a-b
# print(jian(20,10))
# cheng=lambda a,b:a*b
# print(cheng(3,3))
# chu=lambda a,b:a/b
# print(chu(10,2))
# 16、分别定义加、减、乘、除 普通函数，并分别调用
# def jia(a, b):
#     c = a + b
#     return c
#
#
# def jian(a, b):
#     c = a - b
#     return c
#
#
# def cheng(a, b):
#     c = a * b
#     return c
#
#
# def chu(a, b):
#     c = a / b
#     return c
# 17、给16题中的函数增加运算前的说明，运算后的说明


# def test(f):
#     # print("我回复")
#
#     def test1(*d):
#         print("----------")
#         print(f"开始：{f}")
#         print(f(*d))
#         print("结束")
#
#     return test1
#
#
# @test
# def jia(a=10, b=20):
#     return a + b
#
#
# @test
# def jian(a=20, b=10):
#     return a - b
# @test
# def cheng(a=3, b=8):
#     return a*b
# @test
# def chu(a=20, b=4):
#     return a/b
# if __name__ == '__main__':
# print(useR(a1=1))
# print(useR2(a1=1,a2=2))
# print(useR3(1,2,3))
# print(useR4(a=1, b=1))
#
#
# print(jia(1,2))
# print(jian(10,5))
# print(cheng(1,9))
# print(chu(8,2))
# jia()
# jian()
# cheng()
# chu()
# 1-100 奇数加2，偶数*2
# l=[i*2 if i%2==0 else i+2 for  i in range(1,101)]
# l=[i+2 for i in range(1,101) if i%8==0]
# l=[i for i in range(1,101)]
# def maIn(a, b, *c, **d):
#     return a, b, c, d
#
#
# if __name__ == '__main__':
#     print(maIn(1, 2, 1, 2, 3, id=1))
#     print(maIn("1", 2, id=1))
